// pages/home/home.js
Page({
  /**
   * 页面的初始数据
   */
  data: {
     focus: false,
     inputValue: '',
    swiperImgUrls: [
      'http://img1.imgtn.bdimg.com/it/u=4285534929,2466864056&fm=26&gp=0.jpg',
      'http://img.aiimg.com/uploads/allimg/161016/1-1610161QG2.jpg',
      'http://img.aiimg.com/uploads/allimg/141202/1-141202223420.jpg',
      'http://img.aiimg.com/uploads/allimg/191125/1-191125231119.jpg'
    ],
    swiperCurrent: 0,
      showModal: true,
      hiddenName:true,
      hiddenName1:false,
      hiddenName2: true,
      hiddenName3: false,
      imgUrl:null,
      motto:'欢迎登录沃链商城',
      userName:'',
      userPhone:'',
      userCode:'',

     banner: [
        {bannerimg: "./img/fengjing2.png"},
        {bannerimg: "./img/fengjing2.png"},
        {bannerimg: "./img/fengjing2.png"}],
     homelist:[
        {
          goods_id: 1,
         goods_img: './img/yashua2.png',
          goods_title: '亮佳电动牙刷MX213♥',
          goods_daoshoujia: '39',
          goods_yuanjia: '285',
          goods_yuexiao: '2885',
        },
       {
         goods_id: 2,
         goods_img: './img/yashua2.png',
         goods_title: '亮佳电动牙刷MX213❤',
         goods_daoshoujia: '39',
         goods_yuanjia: '285',
         goods_yuexiao: '2885',
       },        
       {
         goods_id: 3,
         goods_img: './img/yashua2.png',
         goods_title: '亮佳电动牙刷521♥♥♥',
         goods_daoshoujia: '39',
         goods_yuanjia: '285',
         goods_yuexiao: '2885',
       },
       {
         goods_id: 4,
         goods_img: './img/yashua2.png',
         goods_title: '亮佳电动牙刷♥♥♥',
         goods_daoshoujia: '39',
         goods_yuanjia: '285',
         goods_yuexiao: '2885',
       },
       {
         goods_id: 5,
         goods_img: './img/yashua2.png',
         goods_title: '亮佳电动牙刷❤',
         goods_daoshoujia: '39',
         goods_yuanjia: '285',
         goods_yuexiao: '2885',
       },
       {
         goods_id: 6,
         goods_img: './img/yashua2.png',
         goods_title: '亮佳电动牙刷MX213♥♥',
         goods_daoshoujia: '39',
         goods_yuanjia: '285',
         goods_yuexiao: '2885',
       }       
     ]
  },
  /** 轮播自动滑动时，获取当前的轮播id
  */
  swiperChange(e) {
    const that = this;
    that.setData({
      swiperCurrent: e.detail.current
    })
  },

  /**
   * 图片手动滑动时，获取当前的轮播id
   */
  imageChange(e) {
    const that = this;
    that.setData({
      swiperCurrent: e.currentTarget.id
    })
  },
  // 昵称input框
  userNameInput: function (e) {
    console.log(e)
    this.setData({
      userName: e.detail.value
    })
    // console.log(e.detail.value);
  },
  //获取手机号
  userPhoneInput: function (e) {
    console.log(e)
    this.setData({
      userPhone: e.detail.value
    })
    // console.log(e.detail.value);
  },
  // 获取验证码
  userCodeInput: function (e) {
    debugger;
    console.log(e)
    this.setData({
      userCode: e.detail.value
    })
    // console.log(e.detail.value);
  },
  showhidden:function(e){
    this.setData({
      hiddenName:!this.data.hiddenName,
      hiddenName1: !this.data.hiddenName1
    })
  },
  setPhotoInfo: function () {
    var that=this;
    wx.chooseImage({
      count:1,
      sizeType:['original','compressed'],
      sourceType:['album','camera'],
      success: function(res) {
        var temFilePaths=res.tempFilePaths
        that.setData({
          imgUrl:temFilePaths,
          hiddenName2: !that.data.hiddenName2,
          hiddenName3: !that.data.hiddenName3
        })
      },
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },
  hideModal() {
    this.setData({
      showModal: false
    });
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },
  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },
  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },
  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },
  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },
  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },
  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  },
  searchBtn: function () {
    alert("你点击了键盘搜索键")
  },
    // 页面滚动
  onPageScroll(e) {
    this.setData({
      scrollTop: e.scrollTop
    })
  }
})